package com.xxyf.config;

import io.swagger.annotations.Api;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

import java.util.ArrayList;

/**
 * @Author 小小怡飞
 * @Date 2022/9/1 5:30
 * @Version JDK 8
 */
@Configuration
public class Sowwgaer {

    @Bean
    public Docket docket(Environment environment){
        return new Docket(DocumentationType.OAS_30)
                .groupName("login")
                .apiInfo(apiInfo())
                .groupName("XXYF")//配置分组
                .select() //去配置扫描接口,RequestHandlerSelectors配置如何扫描接口
                .apis(RequestHandlerSelectors.withClassAnnotation(Api.class)) //扫描包
//                .paths(PathSelectors.ant("/note.do"))//过滤
//                .paths(PathSelectors.ant("/login.do"))
                .build();
    }
    @SuppressWarnings("all")
    private ApiInfo apiInfo(){
        return new ApiInfo("小小怡飞",//标题
                "练手",//描述
                "1.0",//版本
                "http://localhost:8081/",//组织
                new Contact("小小怡飞", "http://localhost:8081/", "2324350936@qq.com"),
                "Apache 2.0",//许可
                "http://www.apache.org/licenses/LICENSE-2.0",//许可连接
                new ArrayList());//扩展
    }


}
